package com.wk.database.entity;

import java.lang.reflect.Field;
import java.util.LinkedList;
import java.util.List;

public class ClassifiedFields {
	public ClassifiedFields(Class<?> entity) {
		mappedIdentifierFields = new LinkedList<>();
		mappedCommonFields = new LinkedList<>();
		
		this.entity = entity;
	}

	public void addIdentifierField(Field field) {
		mappedIdentifierFields.add(field);
	}

	public void addCommonField(Field field) {
		mappedCommonFields.add(field);
	}

	public void validate() throws NoMappedIdentifierException, NoMappedFieldException{
		if(mappedIdentifierFields.isEmpty()){
			throw new NoMappedIdentifierException(entity);
		}
		if(mappedCommonFields.isEmpty()){
			throw new NoMappedFieldException(entity);
		}
	}

	public List<Field> mappedIdentifierFields;
	public List<Field> mappedCommonFields;
	
	private Class<?> entity;
}
